package com.kf.common.utils

import android.annotation.SuppressLint
import com.blankj.utilcode.util.LogUtils
import java.text.SimpleDateFormat

class DateUtils {
    @SuppressLint("SimpleDateFormat")
    fun dateUtils(date: String): String {
        try {
            val format = SimpleDateFormat("yyyy年MM月dd日")
            var toLong = date!!.toLong()
            if (toLong < 1000000000000) {
                toLong *= 1000
            }
            var time = format.format(toLong)
            val substring = time.substring(5, 6)
            val substring1 = time.substring(8, 9)
            if (substring1 == "0") {
                time = time.removeRange(8, 9)
            }
            if (substring == "0") {
                time = time.removeRange(5, 6)
            }
            return time
        } catch (e: Exception) {
            return date
        }
    }
}